<?php
$this->breadcrumbs=array(
	'Deals'=>array('deal/admin'),
	$model->deal->referenceNo=>array('deal/view','id'=>$model->dealId),
	'Attachments',
);

$this->menu=array(
	array('label'=>'Add Attachment', 'url'=>array('create','dealId'=>$model->dealId)),
	array('label'=>'Assign Attachments', 'url'=>array('assignAttachment', 'dealId'=>$model->dealId))
);
?>

<h1>Manage Attachments of Deal <?php echo $model->deal->referenceNo; ?></h1>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'attachment-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>CMap::mergeArray(array(
		'name',
		array(
			'name'=>'notes',
			'type'=>'raw',
			'value'=>'strlen($data->notes)>80?substr($data->notes,0,79)."...":$data->notes',
		),
		array(
			'name'=>'uploadDate',
			'value'=>'date("d/m/Y", strtotime($data->uploadDate))',
			'filter'=>'',
		),
		array(
			'name'=>'createUserId',
			'type'=>'raw',
			'value'=>'$data->createUserId?($data->createUser->firstName." ".$data->createUser->lastName):""',
			'filter'=>'',
		),
		array(
			'header'=>'Files',
			'value'=>'$data->attachmentFileCount'
		),
		array(
			'class'=>'CButtonColumn',
		),
	),GlobalConfiguration::isManageMode()?array(
		array(
			'name'=>'hidden',
			'type'=>'boolean',
			'filter'=>DataUtil::getOptionYesNo(),
		),
	):array()),
)); ?>
